x86/p2m: truly free paging pool memory for dying domains
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 11 Oct 2022 12:54:00 +0000 (14:54 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 11 Oct 2022 12:54:00 +0000 (14:54 +0200)
commit943635d8f8486209e4e48966507ad57963e96284
treefb4fc87ce8db84b594a4c823e95552d99351adb5
parent745e0b300dc3f5000e6d48c273b405d4bcc29ba7
x86/p2m: truly free paging pool memory for dying domains

Modify {hap,shadow}_free to free the page immediately if the domain is
dying, so that pages don't accumulate in the pool when
{shadow,hap}_final_teardown() get called. This is to limit the amount of
work which needs to be done there (in a non-preemptable manner).

Note the call to shadow_free() in shadow_free_p2m_page() is moved after
increasing total_pages, so that the decrease done in shadow_free() in
case the domain is dying doesn't underflow the counter, even if just for
a short interval.

This is part of CVE-2022-33746 / XSA-410.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tim Deegan <tim@xen.org>
master commit: f50a2c0e1d057c00d6061f40ae24d068226052ad
master date: 2022-10-11 14:23:51 +0200
xen/arch/x86/mm/hap/hap.c
xen/arch/x86/mm/shadow/common.c